#==============================================================================
# ** Game_Battler (part 3)
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler
  def add_popup_text(text, type)
    item = Popup_Text.new(text, type)
    item.delay_timer = @popup_texts.size * (6 + rand(6))
    @popup_texts.push(item)
  end
  def add_damge(damge_info)
    add_popup_text(damge_info.value.to_s, damge_info.critcal ? 2 : 1)
    @hp -= damge_info.value
    self.sp += 5
    if @hp < 0
      @hp = 0
    end
    for item in @innate_skills
      item.on_take_damge(damge_info)
    end
  end
  def recover_hp(val)
    @hp += val
    add_popup_text('+' + val.to_s, 3)
  end
end
